<!DOCTYPE html>
<html lang='en'>

<head>
  <meta charset='UTF-8'>
  <meta http-equiv='X-UA-Compatible' content='IE=edge'>
  <meta name='viewport' content='width=device-width, initial-scale=1.0'>
  <title>Document</title>
  <script src='https://cdn.jsdelivr.net/npm/vue/dist/vue.js'></script>
</head>

<body>
  <div id='app'>
    <h2>{{message}}</h2>
    <button @click="showData">显示data</button>
  </div>
  <script>
    let data = {
      message: 'hello world'
    }
    const app = new Vue({
      el: '#app',
      data: data, // vue会把data中的属性都代理到自身上，app.$data === data
      methods: {
        showData() {

        }
      }
    })
    console.log(data === app.$data);
    console.log(app.$el);
    app.$watch('message', function() {
        console.log('cuifan');
      })
      // app.$watch会在监听到属性的变化后调用
  </script>
</body>

</html>